fix(cli): folded paste content was invisible to the model#5347
Conversation
A folded multi-line paste ([Pasted text #N · M lines]) was never seen by the model — only the placeholder label was. The CLI passed the folded label (the un-expanded `line`) as the controller's `raw` value. The Memory v5 compiler (enabled by default) takes `raw` as the source_event of its execution contract, and that contract replaces the whole user turn — so the model's only view of the paste became the label, with the actual content lost. The Desktop path already passes the expanded text as `raw`; only the CLI passed the label. Pass the expanded content (sentLine / msg.display) as `raw` in both the non-refs and @-refs submit paths, matching Desktop. `raw` still excludes resolved @-reference payloads (per the existing TestRunCompilesMemorySourceFromUnexpandedContext intent) — it now carries the expanded paste block but not inline file contents. Add TestPasteFoldExpandOnSubmit, which asserts the memory-compiler source_event holds the expanded paste (it fails before the fix: source_event is only "[Pasted text esengine#1 · 11 lines]"). Co-Authored-By: Claude <noreply@anthropic.com>
SivanCola
left a comment
There was a problem hiding this comment.
Approved. This is a well-scoped fix for the folded-paste regression.
The important part is that the controller raw value now carries the expanded paste text instead of the visible folded placeholder, so Memory v5's source_event no longer loses the actual pasted content. The added regression captures both the runner input and the memory-compiler source input, which is the right contract to pin down here.
Cache impact: low. This changes the dynamic user-turn source text for pasted content only; it does not alter the stable provider-visible prefix, tool schemas, system prompt, or request serialization.
Verified:
Wait for the controller TurnDone event before reading the recording runner output. This gives the async send path a real happens-before edge under go test -race instead of relying on a fixed sleep.
|
Pushed f6b7b42 to fix the failing Root cause: Fix: the test now wires a test event sink and waits for Verified:
|
Summary
A folded multi-line paste ([Pasted text #N · M lines]) was never seen by the model — only the placeholder label was. The CLI passed the folded label (the un-expanded
line) as the controller'srawvalue. The Memory v5 compiler (enabled by default) takesrawas the source_event of its execution contract, and that contract replaces the whole user turn — so the model's only view of the paste became the label, with the actual content lost.Verification
Copy multi-line text and paste into the input erea, then ask the agent how many lines it can see. If it can't see any pasted text, the bug exists.
Cache impact
Cache-impact: TODO
Cache-guard: TODO
System-prompt-review: N/A
For cache-sensitive changes, fill these lines before requesting review:
Cache-impact:none,low,medium, orhigh, plus the reason.Cache-guard: the focused guard test/command added or run, or why an existing guard covers the change.System-prompt-review: required reviewer/approval note when provider-visible system prompt, memory prefix, output style, or skill index behavior changes.